package com.token.sysflow.action;

import com.token.base.AgentAction;
import com.token.base.FuncUtil;
import com.token.sql.IntegrateSql;
import com.token.sysflow.service.*;


/**
 *
 * @author chenjianxiong 2020/5/7
 */
public class AntdTreeOrg implements AgentAction {

    public void executeAction(FuncUtil f) throws Exception {

    }

    public void executeAction(FuncUtil f, IntegrateSql iSql) throws Exception {
        SelectTree selectTree;

        String t = f.getUrlQueryString("t",true,"类型");
        if(t.equals("org")){
            selectTree = new OrgSelectTree(iSql);
        }else if(t.equals("com")) {
            selectTree = new ComSelectTree(iSql);
        }else if(t.equals("dept")) {
            selectTree = new DeptSelectTree(iSql);
        }else if(t.equals("post")) {
            selectTree = new PostSelectTree(iSql);
        }else if(t.equals("role")) {
            selectTree = new RoleSelectTree(iSql);
        }else{
            throw new Exception("没有该类型 " + t);
        }
        selectTree.setCheckable(f.getUrlQueryString("checkable").equals("1"));
        f.putJsonData("data",selectTree.readData());
        selectTree.close();
    }
}
